<?php
require_once 'const/DBConst.php';
?>

<div id="ps">
    <span id="locate">
        <a href="/">首页</a> &raquo; 商品查看
    </span>
</div>
<style type="text/css" media="all">
    #con1 table td{ border-bottom:0px dotted #dfdfdf; padding:0px 0px; text-align:center}
    ul.tab{width:944px;}
    #con1 table {width:954px;}
    .product_safe{border:1px solid #E4E4E4; background-color:#F7F7F7; color:#999; padding:0 5px 0 5px; margin-top:10px; float:right; width:366px; height:30px;}
    .minh300{min-height:180px;}
    .more_img img {width:50xp; height:35px; width:35px; border:1px solid #EBEBEB; padding:1px; cursor:pointer; margin-top:10px;}
    .more_img ul{ list-style:none; text-align:left;}
    .prod_img{text-align:center;}
</style>
<div class="mallLogin"> 
    <div class="welcome" style="float:left; width:748px; height:24px; overflow:hidden;">
        <?php echo $this->product[C_NAME] ?>
    </div>
</div>
<div class="content">
    <div class="compareList">
        <div style="padding: 10px; ">
            <div>
                <div class="compareImg minh300 prod_img">
                    <a href="<?php echo "/upload/" . $this->product["ID"] ?>" class="MagicThumb" >
                        <img height="200px" src="<?php echo "/upload/" . $this->product["ID"] ?>" title="点击查看大图" onerror="this.src='/images/nopic.gif';this.parentNode.href='/images/nopic.gif'" border="0" alt="点击查看大图" />
                    </a>
                </div>
                <div class="compareInfo">
                    <h1>
                        <?php echo $this->product[C_NAME] ?>
                    </h1>
                    <p>
                        售　价：
                        <font color="#FF0000">&yen;</font>
                        <?php echo $this->product[C_PRICE] ?>
                    </p>
                    <p>
                        <a href="#shop" onclick="setUserShopFrame(<?php echo $this->product["ID"] ?>);myshow('usershop');callLoad('loadingiframe');">
                            <img src="/images/default/buy.gif" border="0" alt="点击购买" />
                        </a>
                    </p>
                </div>
            </div>
        </div>
        <div class="clear"></div>
        <div>
            <script language="javascript">
                function setTabProduct(id) {
                    for(var i = 1; i < 3; i++) {
                        displayDiv('con'+i, false);
                        changeClass('tab'+i, '');
                    }
                    displayDiv('con'+id, true);
                    changeClass('tab'+id, 'cur');
                }
            </script>
            <ul class="tab">
                <li class="cur" id="tab1" onclick="setTabProduct('1');">商品详情</li>
                <li class="" id="tab2" onclick="setTabProduct('2');">用户评价</li>
            </ul>
            <div id="con1">
                <table cellpadding="0" cellspacing="0">
                    <tbody>
                        <tr>
                            <th height="0">&nbsp;</th>
                        </tr>
                        <tr>
                            <td style="text-align:left; font-size:14px;padding:10px;">
                                <p><?php echo $this->product[C_DESCRIPTION] ?></p>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div id="con2" style="display: none">
                <table cellpadding="0" cellspacing="0" id="write_review">
                    <tbody>
                        <tr>
                            <th class="leftBorder" width="130" height="0">帐号</th>
                            <th>对<?php echo $this->product[C_NAME] ?>的评论</th>
                        </tr>
                        <?php foreach ($this->replies as $reply): ?>
                            <tr>
                                <td ><?php echo $reply["EMAIL"] ?> :</td>
                                <td><?php echo $reply["CONTENT"] ?></td>
                            </tr>
                        <?php endforeach; ?>

                        </tbody>
                    </table>
                    <hr />
                <?php if ($this->login): ?>
                                <table cellpadding="0" cellspacing="0">
                                    <tbody>
                                        <tr>
                                            <th class="leftBorder" width="130">用户评论</th>
                                            <th>评论内容</th>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td></td>
                                        </tr>
                                    </tbody>
                                </table>
                                <table cellpadding="0" cellspacing="0" id="write_review">
                                    <tbody>
                                    <form name="review" action="<?php echo "/product/reply?id=" . $this->product["ID"] ?>" method="post" enctype="application/x-www-form-urlencoded" onsubmit="return checkData();">
                                        <tr>
                                            <th class="leftBorder" width="130" height="0">参与评价</th>
                                            <th>对<?php echo $this->product[C_NAME] ?>的评论</th>
                                        </tr>
                                        <tr>
                                            <td >评论:</td>
                                            <td><textarea name="content" cols="50" rows="2"></textarea></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td><input name="" type="submit" value="提交" /></td>
                                        </tr>
                                    </form>
                                    </tbody>
                                </table>
                <?php else: ?>
                                    <a href="<?php echo "/account/login?reutrn_url=" . urlencode("/product/view?id=" . $this->product["ID"]) ?>">请登录</a>
                <?php endif; ?>
            </div>
        </div>
    </div>
</div>
<link rel="stylesheet" href="/css/beauty/magicthumb.css" type="text/css" media="screen, projection"/>
<script type="text/javascript" src="/jscript/beauty/magicthumb-packed.js"></script>
<script type="text/javascript">
    MagicThumb.options = {
        keepThumbnail: true,
        zoomPosition: 'center'
    }
</script>
<script language="javascript" src="/jscript/comm/simpleajax.js"></script>
<script language="javascript">
    function showRegisterTip(show) {
        var addslide = document.getElementById('info');
        if(show == true) {
            document.onmousemove = mouseMove;
            addslide.style.display = '';
        } else {
            addslide.style.display = 'none';
            document.onmousemove = null;
        }
    }
    function checkData() {
        var form = document.review;
        if(form.contents.value.length == 0) {
            alert('评论不能为空');
            return false;
        }
    }
</script>